<%-- 
    Document   : _viewCart
    Created on : May 19, 2010, 3:15:03 PM
    Author     : longdm
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib  prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>View Cart Page</title>
    </head>
    <body>
        <h1>Shopping cart</h1>
        <f:view>
        <h:form>
            <h:panelGroup rendered="#{ProductController.cartModel.rowCount <=0}">
                <h:outputText value="Your cart is empty"/>
            </h:panelGroup>

            <h:panelGroup rendered="#{ProductController.cartModel.rowCount>0}">
                <h:dataTable value="#{ProductController.cartModel}" var="cartItem" border="1" bgcolor="lightgray">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Product Name"/>
                        </f:facet>
                        <h:outputText value="#{cartItem.product.productName}" id="productKey"/>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Quantity"/>
                        </f:facet>
                        <h:inputText value="#{cartItem.quantity}"/>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Total"/>
                        </f:facet>
                        <h:inputText value="#{cartItem.total}" id="totalKey"/>
                    </h:column>
                </h:dataTable>
                <hr/>
                <h:panelGrid columns="2">
                    <h:outputText value="Choose ship via:"/>
                    <h:selectOneMenu value="#{OrderController.currentOrderDetail.shipId}" converter="shipConverter">
                        <f:selectItems value="#{OrderController.shipSelectItems}" id="shipViaKey"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <br/>
                <h:commandButton value="Add to Order" action="#{OrderController.callOrderBean}"/>
                <hr/>
                <img src="images/back.jpg" alt="images"/>
                <a href="faces/_productList.jsp">Back</a>
            </h:panelGroup>
        </h:form>
        </f:view>
    </body>
</html>
